<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="css/common.css">
	</head>
	<body>
		<div class="top">在线考试系统</div>
		<div class="container">
			<div class="menus">
				<div class="userName">用户名</div>
				<div class="avatar">
					<div class="avatar_top"></div>
					<div class="pic">
						<img src="img/101.gif"/>
					</div>
				</div>
				<div class="menu" onClick="pageChange(1)">考试管理</div>
				<div class="menu" onClick="pageChange(2)">学生管理</div>
				<div class="menu" onClick="pageChange(3)">教师管理</div>
				<div class="menu" onClick="pageChange(4)">试卷管理</div>
				<div class="menu" onClick="pageChange(5)">用户管理</div>
			</div>
			<div class="datas">
				<div class="forms">
					<div id="operate">
						<span class="btn_add">添加</span>
					</div>
				</div>
				<div class="tables">
					<h2>用户管理</h2><br/>
					<table>
						<tr>
							<th>用户编号</th>
							<th>用户姓名</th>
							<th>用户角色</th>
							<th>操作</th>
						</tr>
						<c:forEach var="u" items="${us }">
							<tr>
								<td>${u.uId }</td>
								<td>${u.uName }</td>
								<td>${u.uRole }</td>
								<td>
									<button onClick="del(${u.uId})">删除</button>
									<button onClick="updateShow(${u.uId })">修改</button>
							</tr>
						</c:forEach>
					</table>
				</div>
				<div class="paginations">
					<div class="pages">
						<span class="page">1</span>
						<span class="page">2</span>
						<span class="page">3</span>
						<span class="page">4</span>
						<span class="page">5</span>
						<span class="page">6</span>
						<span class="page">7</span>
						<span class="page">8</span>
						<span class="page">9</span>
						<span class="page">10</span>
					</div>
				</div>
			</div>
			<div style="clear:both;"></div>
		</div>
		<div class="footer">页脚</div>
		
		<script>
		function add(){
			location.href="add.jsp";
		}
		function del(id){
			location.href="userDel?id="+id;
		}
		function updateShow(id){
			console.log("修改");
			location.href="userUpdateShow?id="+id;
		}
		
		/* 切换管理模块 */
		function pageChange(id){
			switch(id){
			case 1:
				location.href="quiz";
				break;
			case 2:
				location.href="stu";
				break;
			case 3:
				location.href="ts";
				break;
			case 4:
				location.href="paper";
				break;
			case 5:
				location.href="users";
				break;				
			}			
		}
	</script>
	</body>
</html>
